package com.qf.test4;

import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.Pipeline;

/**
 * 批量操作
 * @author zjw
 * @description
 * @date 2021/11/2 9:20
 */
public class DemoTest {

    @Test
    public void test(){
        Jedis jedis = new Jedis("192.168.41.41",6379);
        jedis.auth("P@ssw0rdqwertyuiopasdfghjklzxcvbnm");
        System.out.println(System.currentTimeMillis());
        Pipeline pipelined = jedis.pipelined();
        for (int i = 0; i < 100000; i++) {
            pipelined.set("key" + i,"value" + i);
        }
        // 一次清将管道中的命令发给Redis     IO，网络传输
        pipelined.sync();
        System.out.println(System.currentTimeMillis());
        jedis.close();
    }


}
